package com.zxmc.server.controller.user;

import com.zxmc.common.constant.JwtClaimsConstant;
import com.zxmc.common.properties.JwtProperties;
import com.zxmc.common.result.Result;
import com.zxmc.common.utils.JwtUtil;
import com.zxmc.pojo.dto.UpdateChatHistoryDto;
import com.zxmc.pojo.dto.UserLoginDto;
import com.zxmc.pojo.entity.User;
import com.zxmc.pojo.vo.CommunicateVO;
import com.zxmc.pojo.vo.UserLoginVO;
import com.zxmc.server.service.ChatService;
import com.zxmc.server.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user/chat")
@Slf4j
@Api(tags = "聊天接口")
public class ChatController {
    @Autowired
    private ChatService chatService;
    @ApiOperation("查询聊天历史")
    @GetMapping("/list")
    public Result<List<CommunicateVO>> list(String friendName) {
        log.info("查询聊天历史");
         List<CommunicateVO> list = chatService.list(friendName);
        return Result.success(list);
    }
    @PostMapping("/update")
    public Result update(@RequestBody UpdateChatHistoryDto updateChatHistoryDto){
        log.info("更新聊天历史");
        chatService.update(updateChatHistoryDto);
        return Result.success();
    }
}
